<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="用户编号">
              <a-input placeholder="请输入用户编号" v-model="queryParam.code"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="户名">
                <!-- <j-search-select-tag placeholder="请选择户名" v-model="queryParam.contactId" dict="mws_t_arc_contacts,name,id"/>  -->
                <a-input placeholder="请输入户名" v-model="queryParam.cusName"></a-input>
              </a-form-item>
            </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="片区">
              <j-dict-select-tag placeholder="请选择片区" v-model="queryParam.areaId" dictCode="mws_t_base_areas,name,id"/>
            </a-form-item>
          </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="地址">
                <a-input placeholder="请输入地址" v-model="queryParam.address"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="用户状态">
                <j-dict-select-tag placeholder="请选择用户状态" v-model="queryParam.waterUserStatus" dictCode="water_user_status"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="分组编号">
                <a-input placeholder="请输入分组编号" v-model="queryParam.groupname"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="用水性质">
                <j-dict-select-tag type="list" v-model="queryParam.natureId"  dictCode="mws_t_base_natures,name,id" placeholder="请选择用水性质" />
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="是否预存">
                <j-dict-select-tag placeholder="请选择是否预存" v-model="queryParam.isStored" dictCode="yn"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="是否阶梯">
                <j-dict-select-tag placeholder="请选择是否启用阶梯" v-model="queryParam.isTieredPrice" dictCode="yn"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="是否远传表">
                <j-dict-select-tag placeholder="请选择是否远传表" v-model="queryParam.isRemote" dictCode="yn"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="加压级别">
                <j-dict-select-tag placeholder="请选择加压级别" v-model="queryParam.waterPressurLevel" dictCode="water_pressur_level"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="口径">
                <j-dict-select-tag placeholder="请选择口径" v-model="queryParam.waterCaliberSize" dictCode="water_caliber_size"/>
              </a-form-item>
            </a-col>
            <a-col :xl="10" :lg="11" :md="12" :sm="24">
              <a-form-item label="最后换表时间">
                <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.lastReplacedTime_begin"></j-date>
                <span class="query-group-split-cust"></span>
                <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.lastReplacedTime_end"></j-date>
              </a-form-item>
            </a-col>
            <a-col :xl="10" :lg="11" :md="12" :sm="24">
              <a-form-item label="水表安装日期">
                <j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.firstInstallTime_begin"></j-date>
                <span class="query-group-split-cust"></span>
                <j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.firstInstallTime_end"></j-date>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="本月抄表">
                <j-dict-select-tag placeholder="请选择本月抄表" v-model="queryParam.isRead" dictCode="yn"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="待抄次数">
                <a-input placeholder="请输入待抄次数" v-model="queryParam.unreadTimes"></a-input>
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleOpenStep" type="primary" icon="key">开户</a-button>
      <a-button @click="handleCusNotice" type="primary" icon="bulb">报停</a-button>
      <a-button @click="handleCusStop" type="primary" icon="disconnect">停水</a-button>
      <a-button @click="handleCusCancel" type="primary" icon="poweroff">销户</a-button>
      <a-button @click="handleCusRecover" type="primary" icon="rollback">恢复启用</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('用户水表')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>

      <!-- 高级查询区域 -->
      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
      <a-button @click="showBatchUpModal" type="primary" icon="edit">批量修改</a-button>
      <a-button @click="handleCusRemote" type="primary" icon="edit">读取远传表</a-button>

       <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>

    </div>

    <!-- table区域-begin -->
    <div>
      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div> -->

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="ellipsisText" slot-scope="text">
          <j-ellipsis :value="text" :length="textMaxLength"></j-ellipsis>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">详情</a>
          <a-divider type="vertical" />
          <a @click="handlePrintCard(record)">服务卡</a>
        </span>

      </a-table>
    </div>

    <!-- 打印服务卡 -->
    <template v-if="isPrintCard">
      <a-card :bordered="false" :class="{'abcdefg':true}">
        <div class="no-print" style="text-align: right">
          <a-button v-print="'#printContent'"   @click=" isPrintCard = !isPrintCard " >关闭</a-button>
          <a-button v-print="'#printContent'" style="margin-left: 6px;" ghost type="primary">打印</a-button>
        </div>
        <section ref="print" id="printContent" class="abcdefg">
          <div style="text-align: center">
            <p style="font-size: 24px;font-weight: 800"></p>
            <p style="font-size: 24px;font-weight: 800"></p>
          </div>
          <!--签字-->
          <a-col :md="24" :sm="24">
          <div class="sign" style="text-align: left;height: inherit; line-height: 36px;">
            <a-row>
              <a-col :span="10">
                <span ></span>
              </a-col>
              <a-col :span="10">
                <span style="font-size: 18px;font-weight: 700"> {{row.contactId_dictText }} </span>
              </a-col>
            </a-row>
            <a-row>
              <a-col :span="10">
                <span class="no-print"></span>
              </a-col>
              <a-col :span="10">
                <span style="font-size: 18px;font-weight: 700"> {{row.code }} </span>
              </a-col>
            </a-row>
            <a-row>
              <a-col :span="10">
                <span class="no-print"></span>
              </a-col>
              <a-col :span="10">
                <span style="font-size: 18px;font-weight: 700"> {{row.address }} </span>
              </a-col>
            </a-row>
          </div>
          </a-col>
        </section>
      </a-card>
    </template>

    <div >
      <a-modal
        title="批量修改"
        width="70%"
        :visible="batchUpVisible"
        :confirm-loading="confirmLoading"
        @ok="handleOkBatchUp"
        @cancel="handleCancelBup"
      >
      <a-form-model ref="batchForm" :model="bformData" layout="inline" >
        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改所在片区" prop="bisAreaId">
              <j-dict-select-tag v-model="bformData.bisAreaId" type="radioButton" style=" width:120px;" title="是否修改片区：" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新所在片区："  prop="areaId">
              <j-dict-select-tag type="list" style=" width:280px;" v-model="bformData.areaId" dictCode="mws_t_base_areas,name,id" placeholder="请选择片区" />
            </a-form-model-item>
          </a-col>
        </a-row>

        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改用水性质：" prop="bisNatureId">
              <j-dict-select-tag v-model="bformData.bisNatureId" type="radioButton" style=" width:120px;" title="是否修改用水性质：" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
            <a-input v-model="bformData.ids" hidden="true" ></a-input>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新用水性质">
  	          <j-tree-select  style=" width:280px;"
                ref="treeSelect"
                placeholder="请选择新用水性质"
                v-model="bformData.natureId"
                dict="mws_t_base_natures,name,id"
                pidValue="0"
                class="inpRequire"
                >
              </j-tree-select>
            </a-form-model-item>
          </a-col>
        </a-row>

       <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改抄表表册" prop="bisBookId">
              <j-dict-select-tag v-model="bformData.bisBookId" type="radioButton" style=" width:120px;" title="是否修改抄表周期" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新抄表表册："  prop="bookId">
              <j-search-select-tag v-model="bformData.bookId"  placeholder="请选择新抄表表册" style=" width:280px;"  dict="mws_t_mr_books,name,id"  />
            </a-form-model-item>
          </a-col>
        </a-row>

        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改抄表周期" prop="bisWaterReadCycle">
              <j-dict-select-tag v-model="bformData.bisWaterReadCycle" type="radioButton" style=" width:120px;" title="是否修改抄表周期" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新抄表周期："  prop="waterReadCycle">
              <j-dict-select-tag type="list"  style=" width:280px;"  v-model="bformData.waterReadCycle" dictCode="water_read_cycle"   placeholder="请选择抄表周期" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改水表用途" prop="bisWaterUseType">
              <j-dict-select-tag v-model="bformData.bisWaterUseType" type="radioButton" style=" width:120px;" title="是否修改水表用途" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新水表用途："  prop="waterUseType">
              <j-dict-select-tag type="list"style=" width:280px;" v-model="bformData.waterUseType" dictCode="water_use_type" placeholder="请选择水表用途" />
            </a-form-model-item>
          </a-col>
        </a-row>


        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改水表止度" prop="bisLastReadScale">
              <j-dict-select-tag v-model="bformData.bisLastReadScale" type="radioButton" style=" width:120px;" title="是否修改水表止度" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新水表止度："  prop="lastReadScale">
              <a-input placeholder="新水表止度"  style=" width:280px;" v-model="bformData.lastReadScale"    ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>

        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改水表地址" prop="bisLastAddress">
              <j-dict-select-tag v-model="bformData.bisLastAddress" type="radioButton" style=" width:120px;" title="是否修改水表地址" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新水表地址："  prop="address">
              <a-input placeholder="新水表地址"  style=" width:280px;" v-model="bformData.address"    ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>

         <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改水表#号" prop="bisManholeId">
              <j-dict-select-tag v-model="bformData.bisManholeId" type="radioButton" style=" width:120px;" title="是否水表#号" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新水表#号："  prop="manholeId">
              <a-input placeholder="新水表#号"  style=" width:280px;" v-model="bformData.manholeId"    ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>


        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改本月抄表" prop="bisIsRead">
              <j-dict-select-tag v-model="bformData.bisIsRead" type="radioButton" style=" width:120px;" title="修改是否计费" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新本月抄表："  prop="isRead">
              <j-dict-select-tag type="list"  style=" width:280px;" v-model="bformData.isRead" dictCode="yn" placeholder="请选择是否抄表" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改是否计量" prop="bisIsCalculated">
              <j-dict-select-tag v-model="bformData.bisIsCalculated" type="radioButton" style=" width:120px;" title="修改是否计费" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新是否计量："  prop="isCalculated">
              <j-dict-select-tag type="list"  style=" width:280px;" v-model="bformData.isCalculated" dictCode="yn" placeholder="请选择是否计量" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="10">
            <a-form-model-item label="是否修改是否计费" prop="bisIsCharged">
              <j-dict-select-tag v-model="bformData.bisIsCharged" type="radioButton" style=" width:120px;" title="修改是否计费" dictCode="yn" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="新是否计费："  prop="isCharged">
             <j-dict-select-tag type="list"  style=" width:280px;" v-model="bformData.isCharged" dictCode="yn" placeholder="请选择是否计费" />
            </a-form-model-item>
          </a-col>
        </a-row>

      </a-form-model>
      </a-modal>
    </div>

    <arc-customers-modal ref="modalForm" @ok="modalFormOk"></arc-customers-modal>

    <!-- 表单区域 -->
    <arc-notice-acc-modal ref="noticeForm" v-bind:cusData="selectedRowKeys.join(',')" @ok="modalFormOk"/>
    <!-- 表单区域 -->
    <arc-stop-acc-modal ref="stopForm" v-bind:cusData="selectedRowKeys.join(',')" @ok="modalFormOk"/>
    <!-- 表单区域 -->
    <arc-cancel-acc-modal ref="cancelForm" v-bind:cusData="selectedRowKeys.join(',')" @ok="modalFormOk"/>
    <!-- 表单区域 -->
    <arc-recover-acc-modal ref="recoverForm" v-bind:cusData="selectedRowKeys.join(',')" @ok="modalFormOk"/>

  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { httpAction, getAction } from '@/api/manage'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ArcCustomersModal from './modules/ArcCustomersModal'
  import ArcNoticeAccModal from './modules/noticeAcc/ArcNoticeAccModal'
  import ArcStopAccModal from './modules/stopAcc/ArcStopAccModal'
  import ArcCancelAccModal from './modules/cancelAcc/ArcCancelAccModal'
  import ArcRecoverAccModal from './modules/recoverAcc/ArcRecoverAccModal'
  import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'


  export default {
    name: 'ArcCustomersList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      ArcCustomersModal,
      ArcNoticeAccModal,
      ArcStopAccModal,
      ArcCancelAccModal,
      ArcRecoverAccModal
    },
    data () {
      return {
        description: '用户水表管理页面',
        textMaxLength:5,
        isPrintCard:false,
        batchUpVisible: false,
        confirmLoading: false,
        row:{},
        bformData:{
          bisNatureId:'',
          natureId:'',
          bisBookId:'',
          bookId:'',
          bisWaterReadCycle:'',
          waterReadCycle:'',
          bisWaterUseType:'',
          waterUseType:'',
          bisLastReadScale:'',
          lastReadScale:'',
          bisLastAddress:'',
          address:'',
          bisManholeId:'',
          manholeId:'',
          bisIsCalculated:'',
          bisIsRead:'',
          isRead:'',
          isCalculated:'',
          bisIsCharged:'',
          isCharged:''
         },
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'片区',
            align:"center",
            sorter: true,
            dataIndex: 'areaId_dictText'
          },
          {
            title:'用户编号',
            align:"center",
            sorter: true,
            dataIndex: 'code'
          },
          {
            title:'户名',
            align:"center",
            dataIndex: 'contactId_dictText'  ,
            scopedSlots: {customRender: "ellipsisText"}
          },
          {
            title:'地址',
            align:"center",
            dataIndex: 'address'
          },
          {
            title:'用户状态',
            align:"center",
            dataIndex: 'waterUserStatus_dictText'
          },
          // {
          //   title:'分组编号',
          //   align:"center",
          //   dataIndex: 'groupname'
          // },
          {
            title:'用水性质',
            align:"center",
            dataIndex: 'natureId_dictText'
          },
          // {
          //   title:'启用时间',
          //   align:"center",
          //   dataIndex: 'enabledTime',
          //   customRender:function (text) {
          //     return !text?"":(text.length>10?text.substr(0,10):text)
          //   }
          // },
          {
            title:'水表止度',
            align:"center",
            dataIndex: 'lastReadScale'
          },
          {
            title:'抄表周期',
            align:"center",
            dataIndex: 'waterReadCycle_dictText'
          },
          {
            title:'本月抄表',
            align:"center",
            dataIndex: 'isRead_dictText'
          },
          {
            title:'应抄次数',
            align:"center",
            dataIndex: 'readTimes'
          },
          {
            title:'待抄次数',
            align:"center",
            dataIndex: 'unreadTimes'
          },
          {
            title:'应缴费日',
            align:"center",
            dataIndex: 'paidDay'
          },
          {
            title:'是否计量',
            align:"center",
            dataIndex: 'isCalculated_dictText'
          },
          {
            title:'是否计费',
            align:"center",
            dataIndex: 'isCharged_dictText'
          },
          {
            title:'是否预存',
            align:"center",
            dataIndex: 'isStored_dictText'
          },
          {
            title:'是否增值税',
            align:"center",
            dataIndex: 'isVat_dictText'
          },
          {
            title:'是否预开票',
            align:"center",
            dataIndex: 'isPreinvoiced_dictText'
          },
          {
            title:'是否阶梯',
            align:"center",
            dataIndex: 'isTieredPrice_dictText'
          },
          {
            title:'是否远传表',
            align:"center",
            dataIndex: 'isRemote_dictText'
          },
          // {
          //   title:'加压级别',
          //   align:"center",
          //   dataIndex: 'waterPressurLevel_dictText'
          // },
          // {
          //   title:'水表井号',
          //   align:"center",
          //   dataIndex: 'manholeId'
          // },
          // {
          //   title:'口径',
          //   align:"center",
          //   dataIndex: 'waterCaliberSize_dictText'
          // },
          // {
          //   title:'最后换表时间',
          //   align:"center",
          //   dataIndex: 'lastReplacedTime'
          // },
          // {
          //   title:'初始读数',
          //   align:"center",
          //   dataIndex: 'firstScale'
          // },
          // {
          //   title:'水表安装日期',
          //   align:"center",
          //   dataIndex: 'firstInstallTime',
          //   customRender:function (text) {
          //     return !text?"":(text.length>10?text.substr(0,10):text)
          //   }
          // },

          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:70,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/arc/arcCustomers/list",
          delete: "/arc/arcCustomers/delete",
          batchItem: "/arc/arcCustomers/batchEdit",
          batchRetomeItem: "/mr/mrRecords/readRemoteManual",
          deleteBatch: "/arc/arcCustomers/deleteBatch",
          exportXlsUrl: "/arc/arcCustomers/exportXls",
          importExcelUrl: "arc/arcCustomers/importExcel",

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      //跳转单据页面 src\views\modules\arc\modules\ArcCusStepForm.vue
      handleOpenStep() {
        this.$router.push({path: '/modules/arc/modules/ArcCusStepForm/new'})
      },
      handleCusNotice(){
        if(this.selectedRowKeys.length>0){
          this.$refs.noticeForm.add();
          this.$refs.noticeForm.title = "报停";
          this.$refs.noticeForm.disableSubmit = false;
        }else{
           this.$message.warning("请选择记录");
        }
      },
      handleCusStop(){
        if(this.selectedRowKeys.length>0){
          this.$refs.stopForm.add();
          this.$refs.stopForm.title = "停水";
          this.$refs.stopForm.disableSubmit = false;
        }else{
           this.$message.warning("请选择记录");
        }
      },
      handleCusCancel(){
        if(this.selectedRowKeys.length>0){
          this.$refs.cancelForm.add();
          this.$refs.cancelForm.title = "销户";
          this.$refs.cancelForm.disableSubmit = false;
        }else{
           this.$message.warning("请选择记录");
        }
      },
      handleCusRecover(){
        if(this.selectedRowKeys.length>0){
          this.$refs.recoverForm.add();
          this.$refs.recoverForm.title = "恢复正常使用";
          this.$refs.recoverForm.disableSubmit = false;
        }else{
           this.$message.warning("请选择记录");
        }
      },
      showBatchUpModal() {
        this.batchUpVisible = true;
      },
      handleCusRemote(){
        if(this.selectedRowKeys.length>0){
            var ids = "";
            for (var a = 0; a < this.selectedRowKeys.length; a++) {
              ids += this.selectedRowKeys[a] + ",";
            }
            let formRemote = {
              customerId: ids
            }

            const that = this;

              that.confirmLoading = true;
              let formData = Object.assign(formRemote, {});

              // console.log("表单提交数据",formData)
              httpAction(that.url.batchRetomeItem,formData,"post").then((res)=>{
                if(res.success){
                  that.$message.success(res.message);
                  that.loadData();
                  that.clearBatchForm();
                }else{
                  that.$message.warning(res.message);
                }
              }).finally(() => {
                that.confirmLoading = false;
                that.handleCancelBup();
              })
          }else{
           this.$message.warning("请选择记录");
        }
      },
      handleOkBatchUp(e) {
        //  console.log( this.$refs.batchForm)
        let isup=0;
        if(this.bformData.bisNatureId == 1 && this.bformData.natureId == '' ){
           this.$message.warning("请填写新用水性质");
           isup=1;
        }
        if(this.bformData.bisBookId == 1 && this.bformData.bookId == '' ){
           this.$message.warning("请填写新抄表本表册");
           isup=1;
        }

        if(this.bformData.bisWaterReadCycle == 1 && this.bformData.waterReadCycle  == '' ){
           this.$message.warning("请选择新用水性质");
           isup=1;
        }
        if(this.bformData.bisLastReadScale == 1 && this.bformData.lastReadScale  == '' ){
           this.$message.warning("请填写新抄表止度");
           isup=1;
        }
        if(this.bformData.bisIsCalculated == 1 && this.bformData.isCalculated  == '' ){
           this.$message.warning("请选择新是否计量");
           isup=1;
        }
        if(this.bformData.bisIsCharged == 1 && this.bformData.isCharged  == '' ){
           this.$message.warning("请选择新是否计费");
           isup=1;
        }
        if(this.bformData.bisLastAddress == 1 && this.bformData.address  == '' ){
           this.$message.warning("请填写新水表地址");
           isup=1;
        }
        if(this.bformData.bisManholeId == 1 && this.bformData.manholeId  == '' ){
           this.$message.warning("请填写新水表#号");
           isup=1;
        }


        if(isup !=1 ){

          var ids = "";
          for (var a = 0; a < this.selectedRowKeys.length; a++) {
            ids += this.selectedRowKeys[a] + ",";
          }
          this.bformData.ids = ids;

          const that = this;

            that.confirmLoading = true;
            let formData = Object.assign(that.bformData, {});

            //let formData = Object.assign(that.bformData, values);
            // console.log("表单提交数据",formData)
            httpAction(that.url.batchItem,formData,"post").then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.loadData();
                that.clearBatchForm();
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.handleCancelBup();
            })
        }
      },
      handleCancelBup(e) {
        this.batchUpVisible = false;
      },
      clearBatchForm(){
        this.bformData =
         {
          bisNatureId:'',
          natureId:'',
          bisBookId:'',
          bookId:'',
          bisWaterReadCycle:'',
          waterReadCycle:'',
          bisWaterUseType:'',
          waterUseType:'',
          bisLastReadScale:'',
          lastReadScale:'',
          bisLastAddress:'',
          address:'',
          bisIsCalculated:'',
          bisIsRead:'',
          isRead:'',
          isCalculated:'',
          bisIsCharged:'',
          isCharged:''
         }
      },

      handlePrintCard(row){
        this.isPrintCard=true;
        this.row=row;
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'areaId',text:'片区',dictCode:'mws_t_base_areas,name,id'})
        fieldList.push({type:'string',value:'code',text:'用户编号',dictCode:''})
        fieldList.push({type:'sel_search',value:'contactId',text:'户名',dictTable:'mws_t_arc_contacts', dictText:'name', dictCode:'id'})
        fieldList.push({type:'string',value:'address',text:'地址',dictCode:''})
        fieldList.push({type:'string',value:'waterUserStatus',text:'用户状态',dictCode:'water_user_status'})
        fieldList.push({type:'string',value:'groupname',text:'分组编号',dictCode:''})
        fieldList.push({type:'string',value:'natureId',text:'用水性质'})
        fieldList.push({type:'string',value:'waterUseType',text:'水表用途',dictCode:'water_use_type'})
        fieldList.push({type:'date',value:'enabledTime',text:'启用时间'})
        fieldList.push({type:'int',value:'isCalculated',text:'是否计量',dictCode:'yn'})
        fieldList.push({type:'int',value:'isCharged',text:'是否计费',dictCode:'yn'})
        fieldList.push({type:'int',value:'isStored',text:'是否预存',dictCode:'yn'})
        fieldList.push({type:'int',value:'isVat',text:'是否增值税用户',dictCode:'yn'})
        fieldList.push({type:'int',value:'isPreinvoiced',text:'是否预开票户',dictCode:'yn'})
        fieldList.push({type:'int',value:'isTieredPrice',text:'是否启用阶梯',dictCode:'yn'})
        fieldList.push({type:'int',value:'isRemote',text:'是否远传表',dictCode:'yn'})
        fieldList.push({type:'string',value:'waterPressurLevel',text:'加压级别',dictCode:'water_pressur_level'})
        fieldList.push({type:'string',value:'manholeId',text:'水表井号',dictCode:''})
        fieldList.push({type:'string',value:'waterCaliberSize',text:'口径',dictCode:'water_caliber_size'})
        fieldList.push({type:'datetime',value:'lastReplacedTime',text:'最后换表时间'})
        fieldList.push({type:'BigDecimal',value:'lastReadScale',text:'水表止度',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'firstScale',text:'初始读数',dictCode:''})
        fieldList.push({type:'date',value:'firstInstallTime',text:'水表安装日期'})
        fieldList.push({type:'string',value:'waterReadCycle',text:'抄表周期',dictCode:'water_read_cycle'})
        fieldList.push({type:'int',value:'isRead',text:'本月是否要抄表',dictCode:'yn'})
        fieldList.push({type:'int',value:'readTimes',text:'应抄次数',dictCode:''})
        fieldList.push({type:'int',value:'unreadTimes',text:'待抄次数',dictCode:''})
        fieldList.push({type:'string',value:'paidDay',text:'应缴费日',dictCode:''})
        fieldList.push({type:'string',value:'remark',text:'说明',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';

  .abcdefg .ant-card-body{
    margin-left: 0%;
    margin-right: 0%;
    margin-bottom: 1%;
    border:0px solid black;
    min-width: 800px;
    color:#000000!important;
  }
  .explain{
    text-align: left;
    margin-left: 50px;
    color:#000000!important;
  }
  .explain .ant-input,.sign .ant-input{
    font-weight:bolder;
    text-align:center;
    border-left-width:0px!important;
    border-top-width:0px!important;
    border-right-width:0px!important;
  }
  .explain div{
    margin-bottom: 10px;
  }

</style>